package com.hsource.doctorcenter.service.order.impl;

import cn.hutool.core.convert.Convert;
import com.hsource.doctorcenter.domain.order.OrderDoctor;
import com.hsource.doctorcenter.mapper.OrderDoctorMapper;
import com.hsource.doctorcenter.service.order.IOrderDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单医生信息Service业务层处理
 *
 * @author yangyang
 * @date 2020-09-29
 */
@Service
public class OrderDoctorServiceImpl implements IOrderDoctorService {
    @Autowired
    private OrderDoctorMapper orderDoctorMapper;

    /**
     * 查询订单医生信息
     *
     * @param id 订单医生信息ID
     * @return 订单医生信息
     */
    @Override
    public OrderDoctor selectOrderDoctorById(String id) {
        return orderDoctorMapper.selectOrderDoctorById(id);
    }

    /**
     * 根据问题查找订单医生信息
     * @param problemId
     * @return
     */
    @Override
    public OrderDoctor selectOrderDoctorByProblemId(Integer problemId){
        return orderDoctorMapper.selectOrderDoctorByProblemId(problemId);
    }

    /**
     * 查询订单医生信息列表
     *
     * @param orderDoctor 订单医生信息
     * @return 订单医生信息
     */
    @Override
    public List<OrderDoctor> selectOrderDoctorList(OrderDoctor orderDoctor) {
        return orderDoctorMapper.selectOrderDoctorList(orderDoctor);
    }

    /**
     * 新增订单医生信息
     *
     * @param orderDoctor 订单医生信息
     * @return 结果
     */
    @Override
    public int insertOrderDoctor(OrderDoctor orderDoctor) {
        return orderDoctorMapper.insertOrderDoctor(orderDoctor);
    }

    /**
     * 修改订单医生信息
     *
     * @param orderDoctor 订单医生信息
     * @return 结果
     */
    @Override
    public int updateOrderDoctor(OrderDoctor orderDoctor) {
        return orderDoctorMapper.updateOrderDoctor(orderDoctor);
    }


    /**
     * 更新医生问题ID
     * @param orderDoctor
     * @return
     */
    @Override
    public int updateOrderDoctorProblemIdByDoctorId(OrderDoctor orderDoctor){
        return orderDoctorMapper.updateOrderDoctorProblemIdByDoctorId(orderDoctor);
    }
    /**
     * 删除订单医生信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteOrderDoctorByIds(String ids) {
        return orderDoctorMapper.deleteOrderDoctorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除订单医生信息信息
     *
     * @param id 订单医生信息ID
     * @return 结果
     */
    @Override
    public int deleteOrderDoctorById(String id) {
        return orderDoctorMapper.deleteOrderDoctorById(id);
    }
}
